package io.qiezi.scala.heartbeat

import akka.actor.{ActorSystem, Props}

import scala.concurrent.duration.DurationInt

object App {
  def main(args: Array[String]): Unit = {
    val system = ActorSystem("heartbeat")

    val master = system.actorOf(Props[Master], "master")

    import system.dispatcher
    system.scheduler.scheduleOnce(500 millis) {
      for(i <- 1 to 5) {
        val name = s"worker-$i"
        val worker = system.actorOf(Props(classOf[Worker], master, name), name)
        worker ! Register
      }
    }
  }
}
